

export function COMMUNIST_YOUTH_LEAGUE_SEAL_40(data) {
  const { name, topText, bottomText } = data
  const enterpriseName = name || '某某某科技有限公司团支部'
  const topLineText = topText || ''
  const bottomLineText = bottomText || ''

  const RADIUS = 20 // 半径
  const CIRCLE_WIDTH = 1 // 圆环宽度
  const CIRCLE_PADDING = 1 // 圆环内边距
  const ENTERPRISE_NAME_FONT_SIZE = 5.6 // 企业名称大小
  const ENTERPRISE_NAME_FONT_SCALE_H = 1.2 // 企业名称大小
  const PENTAGONAL_STAR_RADIUS = 4.5 // 五角星半径

  const TOP_LINE_MAXWIDTH = 30 // 上横排文字最大宽度
  const TOP_LINE_FONT_SIZE = 4.5 // 上横排文字大小
  const BOTTOM_LINE_MAXWIDTH = 20 // 下横排文字最大宽度
  const BOTTOM_LINE_FONT_SIZE = 3 // 下横排文字大小

  const LINE_LENGTH = RADIUS - PENTAGONAL_STAR_RADIUS
  const LINE_WIDTH = 0.5

  const config = {
    dpi: 300,

    height: RADIUS * 2,
    width: RADIUS * 2,
    color: 'red',
    charSpace: 0, // 文字间隔
    fontFamily: 'SimSun',
    centerX: RADIUS,
    centerY: RADIUS,
    elements: [
      {
        type: 'CIRCLE',
        radius: RADIUS - CIRCLE_WIDTH / 2,
        lineWidth: CIRCLE_WIDTH
      },
      {
        type: 'CIRCULAR_TEXT',
        text: enterpriseName,
        radius: RADIUS - CIRCLE_WIDTH - CIRCLE_PADDING - ENTERPRISE_NAME_FONT_SIZE * ENTERPRISE_NAME_FONT_SCALE_H / 2,
        fontSize: ENTERPRISE_NAME_FONT_SIZE,
        fontScaleX: 1,
        fontScaleY: ENTERPRISE_NAME_FONT_SCALE_H,
        direction: 1,
        maxAngle: 170
      },
      {
        type: 'TEXT',
        text: topLineText,
        fontSize: TOP_LINE_FONT_SIZE,
        centerX: RADIUS,
        centerY: RADIUS + PENTAGONAL_STAR_RADIUS + (RADIUS - PENTAGONAL_STAR_RADIUS - CIRCLE_WIDTH - CIRCLE_PADDING) / 2 - TOP_LINE_FONT_SIZE / 2,
        maxWidth: TOP_LINE_MAXWIDTH
      },
      {
        type: 'TEXT',
        text: bottomLineText,
        fontSize: BOTTOM_LINE_FONT_SIZE,
        centerX: RADIUS,
        centerY: RADIUS + PENTAGONAL_STAR_RADIUS + (RADIUS - PENTAGONAL_STAR_RADIUS - CIRCLE_WIDTH - CIRCLE_PADDING) / 2 + BOTTOM_LINE_FONT_SIZE / 2,
        maxWidth: BOTTOM_LINE_MAXWIDTH
      },
      {
        type: 'LINE',
        centerX: RADIUS - PENTAGONAL_STAR_RADIUS - LINE_LENGTH / 2,
        centerY: RADIUS,
        length: LINE_LENGTH,
        lineWidth: LINE_WIDTH
      },
      {
        type: 'LINE',
        centerX: RADIUS + PENTAGONAL_STAR_RADIUS + LINE_LENGTH / 2,
        centerY: RADIUS,
        length: LINE_LENGTH,
        lineWidth: LINE_WIDTH
      },
      {
        type: 'PENTAGONAL_STAR',
        radius: PENTAGONAL_STAR_RADIUS
      }
    ]
  }

  return config
}
